home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / DOSGAMES / BOGGLE.ZIP / SOURCE.ZIP / WIP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-03  |  3.0 KB  |  91 lines

  1. /*****************************************************************************
  2. * Program:  WIP.CPP
  3. * Purpose:  Handles the word in process entry field processing
  4. *****************************************************************************/
  5. #include  "bogwin.hpp"
  6. #include  "dict.hpp"
  7.  
  8. class TBogWIP;  //forward declare this class to get a compile!
  9.  
  10. /*****************************************************************************
  11. * Function: TBogWIP
  12. * Parms:    Parms for the parent window
  13. * Purpose:  Create the entry field and instantiate the dictionary
  14. * Returns:  Nothing
  15. *****************************************************************************/
  16. TBogWIP::TBogWIP (unsigned long id,
  17.                   IWindow* parent)
  18.         : IEntryField(id, parent, parent, IRectangle(), defaultStyle() | readOnly)
  19. {
  20.    IFont myfont;
  21.  
  22.    strset(sWIPString, '\0');
  23.    WordChk = new Dictionary("INDEX", "WORDS");
  24.  
  25.  
  26. //Set the font for the control
  27.    myfont.setName("Helvetica")
  28.          .setPointSize(8);
  29.  
  30.    setFont((myfont));
  31.  
  32.    setLimit(16);  // no more than 16 chars in field!!
  33. }
  34.  
  35. /*****************************************************************************
  36. * Function: ~TBogWIP
  37. * Parms:    none
  38. * Purpose:  delete the dictionary
  39. * Returns:  Nothing
  40. *****************************************************************************/
  41. TBogWIP::~TBogWIP()
  42. {
  43.    delete WordChk;
  44. }
  45.  
  46. /*****************************************************************************
  47. * Function: addLetter
  48. * Parms:    sLetter 
  49. * Purpose:  Add the passed letter to the entry field string and show it
  50. * Returns:  Nothing
  51. *****************************************************************************/
  52. void TBogWIP::addLetter(char *sLetter)
  53. {
  54.    /********************************************************
  55.    ** Here we must add the letter to the static control
  56.    ** and repaint it to make it visible to the user.
  57.    ********************************************************/
  58.    if (strlen(sWIPString) < WORDLENGTH)
  59.    {
  60.       strcat(sWIPString, sLetter); 
  61.       setText(sWIPString);
  62.    }
  63. }
  64.  
  65. /*****************************************************************************
  66. * Function: resetString
  67. * Parms:    none
  68. * Purpose:  clear out the word in process string
  69. * Returns:  Nothing
  70. *****************************************************************************/
  71. void TBogWIP::resetString()
  72. {
  73.    strset(sWIPString, '\0');          //Clear array in WIP
  74.    setText(sWIPString);
  75. }
  76.  
  77. /*****************************************************************************
  78. * Function: upString
  79. * Parms:    upword - string to be in upper case,  
  80. * Purpose:  
  81. * Returns:  Nothing
  82. *****************************************************************************/
  83. void TBogWIP::upString(char *upword, char *sDownWord)
  84. {
  85.    /********************************************************
  86.    ** Here we call the ToUpper method in the Dictionary object
  87.    ********************************************************/
  88.    WordChk->ToUpper(upword, sDownWord);
  89. }
  90.  
  91.